#pragma once
#include <string>
using namespace std;

class CRibbonCompiler
{
private:
	std::wstring m_sRibbonXMLFile;
	std::wstring m_sOutput;
	std::wstring m_sUICCPath;
	std::wstring m_sRCPath;
	std::wstring m_sSourceXMLFileText;
	std::wstring m_sLINKPath;
	bool m_bSuccessBuild;
	std::wstring m_sHeaderFile;
	std::wstring m_sResourceFile;

	DWORD ExecuteExternalTool(const std::wstring &commandLine);
	DWORD UICC();
	DWORD RC();
	DWORD LINK(const wstring & outputDLLName);

	wchar_t m_sTempPath[MAX_PATH];
	
	std::wstring GetFileText(const std::wstring &filePath) const;
	void ReadHeaderFile();
	void ReadResourceFile();
	void ReadSourceXMLFile();

public:
	CRibbonCompiler(const wstring &ribbonXMLFile, LPCTSTR szUICCPath, LPCTSTR szRCPath, LPCTSTR szLINKPath);
	~CRibbonCompiler(void);
	DWORD Compile(const wstring & outputDLLName);
	const std::wstring &GetOutput() const;
	std::wstring GetHeaderFileText() const;
	std::wstring GetResourceFileText() const;
	std::wstring GetSourceXMLFileText() const;
	std::wstring GetDirectoryPath(const std::wstring &filePath) const;
	std::wstring GetSourceXMLFilePath() const { return m_sRibbonXMLFile; }
	
};
